<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/13
 * Time: 16:13
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Logics\MiniProgram\PartyCategoryLogic;
use App\Http\Traits\PartyCategoryTrait;
use App\Http\Controllers\BaseController;
class PartyCategoryController extends BaseController
{
    use PartyCategoryTrait;

    /**
     * @SWG\Get(
     *     path="/partyCategory/list",
     *     tags={"PartyCategory"},
     *     description="获取活动分类列表",
     *     operationId="getPartyCategoryList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="key",
     *         in="query",
     *         description="合作者key",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartyCategoryList()
    {
        $key = $this->key;
        $data = [
            'key' => $key
        ];
        $response = PartyCategoryLogic::getPartyCategoryList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }


    /**
     * @SWG\Get(
     *     path="/partyCategory/detail",
     *     tags={"PartyCategory"},
     *     description="获取活动分类详情",
     *     operationId="getPartyCategoryDetail",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_category_id",
     *         in="query",
     *         description="活动分类ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartyCategoryDetail()
    {
        $party_category_id = $this->party_category_id;
        $data = [
            'party_category_id' => $party_category_id
        ];
        $response = PartyCategoryLogic::getPartyCategoryDetail($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/partyCategory/delete",
     *     tags={"PartyCategory"},
     *     description="删除活动分类",
     *     operationId="deletePartyCategory",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_category_id",
     *         in="query",
     *         description="活动分类ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function deletePartyCategory()
    {
        $party_category_id = $this->party_category_id;
        $data = [
            'party_category_id' => $party_category_id
        ];
        $response = PartyCategoryLogic::deletePartyCategory($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}